package com.example.beaninitdestory;

import com.example.beaninitdestory.service.BeanWayService;
import com.example.beaninitdestory.service.JSR250WayService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class BeanInitDestoryApplication implements ApplicationRunner {

    public static void main(String[] args) {
        SpringApplication.run(BeanInitDestoryApplication.class, args);
    }

    @Bean(initMethod = "init", destroyMethod = "destory")
    public BeanWayService beanWayService() {
        return new BeanWayService();
    }

    @Bean
    public JSR250WayService jsr250WayService() {
        return new JSR250WayService();
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {

    }
}
